package org.cfg;

import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import org.apache.commons.lang3.ArrayUtils;
import java.util.HashMap;
import com.sojoys.artifact.tools.SK_String;
import com.xiaoleilu.hutool.util.StrUtil;
import java.util.ArrayList;
import com.sojoys.artifact.build.data.base.BaseCfg;
import org.base.BaseGoods;
import java.util.List;
import com.sojoys.artifact.tools.ToolMap;
import com.sojoys.artifact.tools.ToolCopy;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.sojoys.artifact.constant.DataModelKeyEnum;
/**
 * 英雄
 */
public class HeroCfg extends BaseCfg<HeroCfg> implements org.base.BaseGoods{

	/**
	 * 数据库表名称
	 */
	public static final String TABLE_NAME = "hero";
	/**
	 * 完整类名称
	 */
	public static final String CLASS_NAME = "org.cfg.HeroCfg"; 
	/**
	 * 字段个数
	 */
	public static final int COLUMN_COUNT= 13;
	/**
	 * 数据库源字段注释
	 */
	public static final String[] SOURCE_COLUMN_REMARKS = new String[]{"","所属精灵","碎片ID","品质","排位","排位顺序","突破属性项","进阶属性项","转换","星级技能点","天使觉醒消耗","默认皮肤","可选皮肤",};
	/**
	 * 数据库源字段名字
	 */
	public static final String[] SOURCE_COLUMN_NAMES = new String[]{"id","role","compose","rarity","site","order","attribute","attribute2","convert","skillPoint","angelWakeCons","defaultSkin","optionalSkin",};
	/**
	 * 拼音字段名字
	 */
	public static final String[] PINGYING_COLUMN_NAMES = new String[]{"id","role","compose","rarity","site","order","attribute","attribute2","convert","skillPoint","angelWakeCons","defaultSkin","optionalSkin",};
	/**
	 * HashCode字段名字
	 */
	public static final Integer[] HASHCODE_COLUMN_NAMES = new Integer[]{3355,3506294,950497682,-938161749,3530567,106006350,13085340,405645590,951590323,1593533887,-1730179562,-436983970,1822225661,};
	/**
	 * 字段基本类型
	 */
	public static final String[] COLUMN_BASICTYPES = new String[]{"int","int","Map","int","int","int","int","int","Map","List","List","int","int[]",};
	/**
	 * 字段引用类型
	 */
	public static final Class[] COLUMN_CLASSTYPES = new Class[]{Integer.class,Integer.class,Map.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Map.class,List.class,List.class,Integer.class,int[].class,};
	
	/**
	 * id
	 */
	private int id;
	
	/**
	 * 所属精灵
	 */
	private int role;
	
	/**
	 * 碎片ID
	 */
	private Map compose;
	
	/**
	 * 品质
	 */
	private int rarity;
	
	/**
	 * 排位
	 */
	private int site;
	
	/**
	 * 排位顺序
	 */
	private int order;
	
	/**
	 * 突破属性项
	 */
	private int attribute;
	
	/**
	 * 进阶属性项
	 */
	private int attribute2;
	
	/**
	 * 转换
	 */
	private Map convert;
	
	/**
	 * 星级技能点
	 */
	private List skillPoint;
	
	/**
	 * 天使觉醒消耗
	 */
	private List angelWakeCons;
	
	/**
	 * 默认皮肤
	 */
	private int defaultSkin;
	
	/**
	 * 可选皮肤
	 */
	private int[] optionalSkin;
	
	
	
	public static HeroCfg builder() {
		HeroCfg heroCfg = new HeroCfg();
		return heroCfg;
	}
	
	/**
	 * id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * 所属精灵
	 */
	public int getRole() {
		return role;
	}
	
	/**
	 * 碎片ID
	 */
	public Map getCompose() {
		return compose;
	}
	
	/**
	 * 品质
	 */
	public int getRarity() {
		return rarity;
	}
	
	/**
	 * 排位
	 */
	public int getSite() {
		return site;
	}
	
	/**
	 * 排位顺序
	 */
	public int getOrder() {
		return order;
	}
	
	/**
	 * 突破属性项
	 */
	public int getAttribute() {
		return attribute;
	}
	
	/**
	 * 进阶属性项
	 */
	public int getAttribute2() {
		return attribute2;
	}
	
	/**
	 * 转换
	 */
	public Map getConvert() {
		return convert;
	}
	
	/**
	 * 星级技能点
	 */
	public List getSkillPoint() {
		return skillPoint;
	}
	
	/**
	 * 天使觉醒消耗
	 */
	public List getAngelWakeCons() {
		return angelWakeCons;
	}
	
	/**
	 * 默认皮肤
	 */
	public int getDefaultSkin() {
		return defaultSkin;
	}
	
	/**
	 * 可选皮肤
	 */
	public int[] getOptionalSkin() {
		return optionalSkin;
	}
	
	
	protected Object[] getColumnNames(DataModelKeyEnum e){
		switch (e) {
		case SOURCE:
			return SOURCE_COLUMN_NAMES;
		case PINGYING:
			return PINGYING_COLUMN_NAMES;
		case HASHCODE:
			return HASHCODE_COLUMN_NAMES;
		case REMARKS:
			return SOURCE_COLUMN_REMARKS;
		default:
			return PINGYING_COLUMN_NAMES;
		}
	}
	
	protected String[] getBasicTypes(){
		return COLUMN_BASICTYPES;
	}
	
	protected Class[] getClassTypes(){
		return COLUMN_CLASSTYPES;
	}
	
	protected Object[] getColumeValues(){
		Object[] values = new Object[COLUMN_COUNT];
        values[0] = this.id;
        values[1] = this.role;
        values[2] = this.compose;
        values[3] = this.rarity;
        values[4] = this.site;
        values[5] = this.order;
        values[6] = this.attribute;
        values[7] = this.attribute2;
        values[8] = this.convert;
        values[9] = this.skillPoint;
        values[10] = this.angelWakeCons;
        values[11] = this.defaultSkin;
        values[12] = this.optionalSkin;
        return values;
	}
	
	protected HeroCfg createColumeValues(Object[] vals) {
		this.id = (int)vals[0];
		this.role = (int)vals[1];
		this.compose = (Map)vals[2];
		this.rarity = (int)vals[3];
		this.site = (int)vals[4];
		this.order = (int)vals[5];
		this.attribute = (int)vals[6];
		this.attribute2 = (int)vals[7];
		this.convert = (Map)vals[8];
		this.skillPoint = (List)vals[9];
		this.angelWakeCons = (List)vals[10];
		this.defaultSkin = (int)vals[11];
		this.optionalSkin = (int[])vals[12];
		return this;
	}
	
	protected Map<Object, Object> toMap(Object[] keys,Map<Object, Object> map){
        map.put(keys[0], this.id);
        map.put(keys[1], this.role);
        map.put(keys[2], this.compose);
        map.put(keys[3], this.rarity);
        map.put(keys[4], this.site);
        map.put(keys[5], this.order);
        map.put(keys[6], this.attribute);
        map.put(keys[7], this.attribute2);
        map.put(keys[8], this.convert);
        map.put(keys[9], this.skillPoint);
        map.put(keys[10], this.angelWakeCons);
        map.put(keys[11], this.defaultSkin);
        map.put(keys[12], this.optionalSkin);
        return map;
    }
    
    protected HeroCfg createForMap(Object[] keys,Map map){
   		this.id = (int)map.get(keys[0]);
   		this.role = (int)map.get(keys[1]);
   		this.compose = (Map)map.get(keys[2]);
   		this.rarity = (int)map.get(keys[3]);
   		this.site = (int)map.get(keys[4]);
   		this.order = (int)map.get(keys[5]);
   		this.attribute = (int)map.get(keys[6]);
   		this.attribute2 = (int)map.get(keys[7]);
   		this.convert = (Map)map.get(keys[8]);
   		this.skillPoint = (List)map.get(keys[9]);
   		this.angelWakeCons = (List)map.get(keys[10]);
   		this.defaultSkin = (int)map.get(keys[11]);
   		this.optionalSkin = (int[])map.get(keys[12]);
        return this;
    }
	
	
	protected JSONObject toJSONObject(Object[] keys,JSONObject obj){
        obj.put(keys[0], this.id);
        obj.put(keys[1], this.role);
        obj.put(keys[2], this.compose);
        obj.put(keys[3], this.rarity);
        obj.put(keys[4], this.site);
        obj.put(keys[5], this.order);
        obj.put(keys[6], this.attribute);
        obj.put(keys[7], this.attribute2);
        obj.put(keys[8], this.convert);
        obj.put(keys[9], this.skillPoint);
        obj.put(keys[10], this.angelWakeCons);
        obj.put(keys[11], this.defaultSkin);
        obj.put(keys[12], this.optionalSkin);
        return obj;
    }
    
    protected HeroCfg createForJSONObject(Object[] keys,JSONObject obj){
	    this.id = obj.getIntValue(keys[0]);
	    this.role = obj.getIntValue(keys[1]);
		this.compose = obj.getObject(keys[2],Map.class);
	    this.rarity = obj.getIntValue(keys[3]);
	    this.site = obj.getIntValue(keys[4]);
	    this.order = obj.getIntValue(keys[5]);
	    this.attribute = obj.getIntValue(keys[6]);
	    this.attribute2 = obj.getIntValue(keys[7]);
		this.convert = obj.getObject(keys[8],Map.class);
		this.skillPoint = obj.getObject(keys[9],List.class);
		this.angelWakeCons = obj.getObject(keys[10],List.class);
	    this.defaultSkin = obj.getIntValue(keys[11]);
		this.optionalSkin = obj.getObject(keys[12],int[].class);
        return this;
    }
    
    protected void writeBytes(IByteBuff byteBuf){
	    byteBuf.writeInt(this.id);
	    byteBuf.writeInt(this.role);
	    byteBuf.writeObject(this.compose);
	    byteBuf.writeInt(this.rarity);
	    byteBuf.writeInt(this.site);
	    byteBuf.writeInt(this.order);
	    byteBuf.writeInt(this.attribute);
	    byteBuf.writeInt(this.attribute2);
	    byteBuf.writeObject(this.convert);
	    byteBuf.writeObject(this.skillPoint);
	    byteBuf.writeObject(this.angelWakeCons);
	    byteBuf.writeInt(this.defaultSkin);
	    byteBuf.writeObject(this.optionalSkin);
    }
	
	protected HeroCfg readBytes(IByteBuff byteBuf){
	    this.id = byteBuf.readInt(null);
	    this.role = byteBuf.readInt(null);
	    this.compose = (Map)byteBuf.readObject();
	    this.rarity = byteBuf.readInt(null);
	    this.site = byteBuf.readInt(null);
	    this.order = byteBuf.readInt(null);
	    this.attribute = byteBuf.readInt(null);
	    this.attribute2 = byteBuf.readInt(null);
	    this.convert = (Map)byteBuf.readObject();
	    this.skillPoint = (List)byteBuf.readObject();
	    this.angelWakeCons = (List)byteBuf.readObject();
	    this.defaultSkin = byteBuf.readInt(null);
	    this.optionalSkin = byteBuf.readIntArray(null);
	    return this;
	}
	
	public HeroCfg deepCopy(){
		HeroCfg heroCfg = null;
		try {
			heroCfg = (HeroCfg) super.clone();
		    heroCfg.compose = ToolCopy.copyObject(this.compose);
		    heroCfg.convert = ToolCopy.copyObject(this.convert);
		    heroCfg.skillPoint = ToolCopy.copyObject(this.skillPoint);
		    heroCfg.angelWakeCons = ToolCopy.copyObject(this.angelWakeCons);
		    heroCfg.optionalSkin = ToolCopy.copyObject(this.optionalSkin);
			return heroCfg;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return heroCfg;
	}
//自定义内容起始位置

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getNameTextId() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getSuperType() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getSubType() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getSmallType() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getBagType() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getStar() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getQuality() {
		return getRarity();
	}

	@Override
	public Map getSellProfit() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map getUseCast() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map getUseProfit() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getTotalMax() {
		// TODO Auto-generated method stub
		return 1;
	}

	@Override
	public int getGridMax() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getOnceUseLimit() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Map getDealProfit() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map getConvertMax() {
		return getConvert();
	}

	@Override
	public boolean getPileUp() {
		return false;
	}

	@Override
	public boolean getAutoUse() {
		// TODO Auto-generated method stub
		return false;
	}
	
//自定义内容结束位置
}
